<form class="form-horizontal" name="host_form"  ng-submit="do_submit()">
<div class="modal-header">
  <a class="close" ng-click="close()">×</a>
  <h3>{{title}}</h3>
</div>
<div class="modal-body">
  <div class="row-fluid">
    <div class="control-group">
      <label class="control-label">任务名称：</label>
      <div class="controls">
        <input type="text" required ng-model="event.title" placeholder="任务名称" />
      </div>
    </div>

    <div class="control-group">
        <label class="control-label">执行时间：</label>
        <div class="controls">
            <input type="text" id="valid_time" class="span8" ng-model="event.start" readonly="readonly">
            <pickdate></pickdate>
        </div>
    </div>

      <!--
    <div class="control-group">
      <label class="control-label">开始时间：</label>
      <div class="controls">
        <div class="input-append span5">
          <input type="text" class="span9" ng-model="event.start" bs-datepicker>
          <button type="button" class="btn" data-toggle="datepicker"><i class="icon-calendar"></i></button>
        </div>
          <div class="input-append span5">  
          <input type="text" class="span8" data-show-meridian="false" data-show-seconds="true" ng-model="event.starttime" bs-timepicker>
          <button type="button" class="btn" data-toggle="timepicker"><i class="icon-time"></i></button>
          </div>
      </div>
    </div>
    -->

    <div class="control-group">
      <label class="control-label">执行任务：</label>
      <div class="controls">
          <select ng-model="event.task" ng-options="t as t.name for t in tasks" class="span9" required ng-change="changetask()"></select>
      </div>
    </div>
      <!--
    <div class="control-group">
      <label class="control-label">executor：</label>
      <div class="controls">
        <select ng-model="event.server" ng-options="s.host_name as s.host_name for s in hosts" class="span9" required multiple=""></select>
      </div>
    </div>

      <div class="control-group">
          <label class="control-label">params：</label>
          <div class="controls">
              <textarea class="span9">{{ params }}</textarea>
          </div>
      </div>
      -->

      <div class="control-group" ng-show="event.task.value!='create_vm'">
          <label class="control-label">虚拟机：</label>
          <div class="controls">
              <select ng-model="event.vm" ng-options="s as s.displayname for s in vms" class="span9" required ng-change="changevm()" ng-show="event.task.value!='snapshot_restore'"></select>
              <select ng-model="event.vm" ng-options="s as s.displayname for s in snapshotvms" class="span9" required ng-change="changevm()" ng-show="event.task.value=='snapshot_restore'"></select>
          </div>
      </div>

      <div class="control-group" ng-show="event.task.value=='snapshot_vm'">
          <label class="control-label">快照名称：</label>
          <div class="controls">
              <input type="text" ng-model="event.snapshotname" ng-required="event.task.value=='snapshot_vm'">
          </div>
      </div>

      <div class="control-group" ng-show="event.task.value=='snapshot_restore'">
          <label class="control-label">还原快照：</label>
          <div class="controls">
              <select ng-model="event.snapshot" ng-options="s as s.name for s in snapshots" class="span9" ng-required="event.task.value=='snapshot_restore'"></select>
          </div>
      </div>

    <div class="control-group">
      <label class="control-label">任务描述：</label>
      <div class="controls">
        <textarea ng-model="event.description" class="span9" required></textarea>
      </div>
    </div>
    <!---
    <div class="control-group">
      <label class="control-label">优先级：</label>
      <div class="controls">
        <select ng-model="event.priority" ng-options="o.value as o.name for o in priorities" class="span5"></select>
      </div>
    </div>
    -->
  </div>  
</div>
<div class="modal-footer">
  <a data-dismiss="modal" class="btn" ng-click="close()">关闭</a>
  <button type="submit" ng-disabled="!host_form.$valid" class="btn btn-primary">保存</button>
</div>
</form>